clear;clc;

SOLUTION_LowPers_Ex =   load("../2_RobCheck_5_IntegrationPersistence/2_MainResults/Result_LowPers.mat").SOLUTION;
SOLUTION_LowPers_En =   load("../../../03_OHANK_02_EndoTransition/Analysis/2_MainResults/Result_LowPers.mat").SOLUTION;

TempList    =   {SOLUTION_LowPers_Ex, SOLUTION_LowPers_En};
LabelList   =   {'OnlyLiability','Liability'};

TempNum     =   length(TempList);
Tables      =   cell(TempNum,1);

parfor ii=1:TempNum
    vv          =   TempList{ii};
    Tables{ii}  =   SubFun_CollectResults(vv);
end

FileName    =   'TableGraphs\\ModelExtension_FCD.xlsx';
ShockList   =   {'Eps_Eta_M_dom', 'Eps_Eta_Y_H', 'Eps_Eta_M_ext'};
for ii=1:length(ShockList)
    SH          =   ShockList{ii};
    TempData    =   [];
    for jj=1:TempNum
        TempData    =   [TempData,Tables{jj}.(SH)];
    end
    TempTable   =   array2table(TempData,'VariableNames',LabelList,'RowNames',Tables{1}.Row);
    writetable(TempTable,FileName,'WriteRowNames',true,'Sheet',SH);
end